package com.anyou.mall.pla.service.impl;

import java.util.List;

import com.anyou.common.core.domain.ApiResult;
import com.anyou.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.anyou.mall.pla.mapper.PlaIdentityTypeMapper;
import com.anyou.mall.pla.domain.PlaIdentityType;
import com.anyou.mall.pla.service.IPlaIdentityTypeService;

/**
 * 身份类型Service业务层处理
 * 
 * @author ylj
 * @date 2022-03-18
 */
@Service
public class PlaIdentityTypeServiceImpl extends ServiceImpl<PlaIdentityTypeMapper, PlaIdentityType> implements IPlaIdentityTypeService
{
    @Autowired
    private PlaIdentityTypeMapper plaIdentityTypeMapper;

    /**
     * 查询身份类型
     * 
     * @param identityTypeId 身份类型主键
     * @return 身份类型
     */
    @Override
    public PlaIdentityType selectPlaIdentityTypeByIdentityTypeId(Long identityTypeId)
    {
        return plaIdentityTypeMapper.selectPlaIdentityTypeByIdentityTypeId(identityTypeId);
    }

    /**
     * 查询身份类型列表
     * 
     * @param plaIdentityType 身份类型
     * @return 身份类型
     */
    @Override
    public List<PlaIdentityType> selectPlaIdentityTypeList(PlaIdentityType plaIdentityType)
    {
        return plaIdentityTypeMapper.selectPlaIdentityTypeList(plaIdentityType);
    }

    /**
     * 新增身份类型
     * 
     * @param plaIdentityType 身份类型
     * @return 结果
     */
    @Override
    public int insertPlaIdentityType(PlaIdentityType plaIdentityType)
    {
        plaIdentityType.setCreateTime(DateUtils.getNowDate());
        return plaIdentityTypeMapper.insertPlaIdentityType(plaIdentityType);
    }

    /**
     * 修改身份类型
     * 
     * @param plaIdentityType 身份类型
     * @return 结果
     */
    @Override
    public int updatePlaIdentityType(PlaIdentityType plaIdentityType)
    {
        plaIdentityType.setUpdateTime(DateUtils.getNowDate());
        return plaIdentityTypeMapper.updatePlaIdentityType(plaIdentityType);
    }

    /**
     * 批量删除身份类型
     * 
     * @param identityTypeIds 需要删除的身份类型主键
     * @return 结果
     */
    @Override
    public int deletePlaIdentityTypeByIdentityTypeIds(Long[] identityTypeIds)
    {
        return plaIdentityTypeMapper.deletePlaIdentityTypeByIdentityTypeIds(identityTypeIds);
    }

    /**
     * 删除身份类型信息
     * 
     * @param identityTypeId 身份类型主键
     * @return 结果
     */
    @Override
    public int deletePlaIdentityTypeByIdentityTypeId(Long identityTypeId)
    {
        return plaIdentityTypeMapper.deletePlaIdentityTypeByIdentityTypeId(identityTypeId);
    }

    @Override
    public ApiResult<List<PlaIdentityType>> getAllList() {
        List<PlaIdentityType> plaIdentityTypeList = plaIdentityTypeMapper.getAllList();
        return ApiResult.success(plaIdentityTypeList);
    }
}
